﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using HNQXYJ.DAL;
using HNQXYJ.Model;
namespace HNQXYJ.BLL
{
    public class CountyBLL
    {
        /// <summary>
        /// 通过城市代码获取该城市下的有县
        /// </summary>
        /// <param name="parentcode"></param>
        /// <returns></returns>
        public List<HCounty> GetCountyListByParentCode(string parentcode)
        {
             CountyDAL cd = new CountyDAL();
             List<HCounty> list = new List<HCounty>();
             list = cd.GetCountyListByParentCode(parentcode);
             return list;
        }
      

        /// <summary>
        /// 增加新的县（区）
        /// </summary>
        /// <param name="county"></param>
        /// <returns></returns>
        public int AddCounty(HCounty county)
        {
            int res = new CountyDAL().AddCounty(county);
            return res;
        }
  

         /// <summary>
        /// 根据一个id删除一个县
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DeleteCountyById(int id)
        {
            int res = new CountyDAL().DeleteCountyById(id);
            return res;
        }

         /// <summary>
        /// 根据id获取县区对象
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public HCounty GetCountyById(int id)
        {
            HCounty county = new CountyDAL().GetCountyById(id);
            return county;
        }

         /// <summary>
        /// 更新一个县区对象
        /// </summary>
        /// <param name="county"></param>
        /// <returns></returns>
        public int UpdateCounty(HCounty county)
        {
            int res = new CountyDAL().UpdateCounty(county);
            return res;
        }
         /// <summary>
        /// 对所有的县区进行分页列表
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="parentCode"></param>
        /// <param name="rowCount"></param>
        /// <param name="pageCount"></param>
        /// <returns></returns>
        public List<HCounty> GetCountyPagedList(int pageIndex, int pageSize, string parentCode, out int rowCount, out int pageCount)
        {
            List<HCounty> list = new CountyDAL().GetCountyPagedList(pageIndex, pageSize, parentCode, out rowCount, out pageCount);
            return list;
        }

        /// <summary>
        /// 根据一个县的代码获取该县的对象
        /// </summary>
        /// <param name="selfCode"></param>
        /// <returns></returns>
        public HCounty GetCountyBySelfCode(string selfCode)
        {
            HCounty county = new CountyDAL().GetCountyBySelfCode(selfCode);
            return county;
        }

    }
}